package com.bii.gelapp;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;

public class DNAValueEditDialog extends Dialog{
	
	public Context Markercontext;
	EditText etValue;
	int index;
	int value;
	String compareorigin;
	
	public DNAValueEditDialog(Context context, int index) {
		super(context);
		this.index = index;
		this.Markercontext = context;
		Log.d("tag1", "index: " + index);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.markervaluedialog);
		WindowManager.LayoutParams wmlp = this.getWindow().getAttributes();
		WindowManager wm = (WindowManager) this.Markercontext.getSystemService(Context.WINDOW_SERVICE);
		Display display = wm.getDefaultDisplay();
		wmlp.gravity = Gravity.CENTER_VERTICAL;
		wmlp.width = display.getWidth();
		int value = DNAValueActivity.markervalues.get(index);
		
		etValue = (EditText)findViewById(R.id.etValue);
		etValue.setText(""+value);
		Button btConfirm = (Button)findViewById(R.id.btConfirm);
		btConfirm.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
					int valuechanged = Integer.parseInt(etValue.getText().toString());
					DNAValueActivity.markervalues.set(index, valuechanged);
					dismiss();
			}
		});
		
		Button btCancel = (Button)findViewById(R.id.btCancel);
		btCancel.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				dismiss();
			}
		});
	}
	
	
}
